import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import { fileURLToPath, URL } from "node:url";
export default defineConfig({
  plugins: [react()],
  server: {
    host: '0.0.0.0',
    port: 3000,
    open: true,
    proxy: {
      '/api': {
        target: 'https://www.fastmock.site/mock/f417dec6914953cf9e58f4f0a0cc2838',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '/api'),
      },
    }
  },
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
      "@a": fileURLToPath(new URL("./src/api", import.meta.url)),
      "@c": fileURLToPath(new URL("./src/components", import.meta.url)),
      "@s": fileURLToPath(new URL("./src/store", import.meta.url)),
      "@u": fileURLToPath(new URL("./src/utils", import.meta.url)),
      "@p": fileURLToPath(new URL("./src/pages", import.meta.url)),
    },
  }
})
